package com.firewolf.rabbitmq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import utils.ConnectionUtils;

public class Sender {
	
	private static final String QUEUE_NAME = "queue_confirmqueue_serial";
	public static void main(String[] args) throws Exception {
		
		Connection connection = ConnectionUtils.getMQConnection();
		
		Channel channel = connection.createChannel();
		
		channel.queueDeclare(QUEUE_NAME, false, false,false, null);
		
		
		channel.confirmSelect();
		
		for(int i = 0 ;i<10;i++){
			channel.basicPublish("", QUEUE_NAME,null, ("Hello"+i).getBytes());
		}
		
		if(channel.waitForConfirms()){
			System.out.println("消息发送完成");
		}
	}
}
